﻿using System;
using System.Collections.ObjectModel;
using System.Windows.Media.Imaging;

namespace Warehouse.Silverlight.Modules.Main.Models
{
    //Header(String), link(Uri), icon(Uri)
    public class NavTreeItem
    {
        private readonly string _link;
        private readonly string _icon;

        public NavTreeItem(string header) : this(header, null) { }

        public NavTreeItem(string header, string link)
		{
			if (link != null)
			{
				_link = link.Trim();
			}

			this.Header = header;
		}

        public NavTreeItem(string header, string link, string icon)
        {

        }

		public string Header { get; set; }

        public string Link { get { return _link; } }

        public string Icon { get { return _icon; } }

        public ObservableCollection<NavTreeItem> Items { get; set; }

        public NavTreeItem AddItem(NavTreeItem item)
		{
			if (Items != null)
                Items.Add(item);
			else
                Items = SubItems(item);

            return this;
		}

        public static ObservableCollection<NavTreeItem> SubItems(params NavTreeItem[] items)
		{
            return new ObservableCollection<NavTreeItem>(items);
		}

    }
}
